﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "settingsdialog.h"
#include "aboutdialog.h"
#include "chartview/chartview.h"
#include <QMainWindow>

class QComboBox;
class QRadioButton;
class QLabel;
class QTabWidget;
class DataView;
class InsightView;
class QActionGroup;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    void find(const QString& text);
    void tabClosed(int index);
    void tabChanged(int index);
    void addressChanged(DataView* view, qint64 address);
    void viewGroupTriggered(QAction* action);
    void on_actionFind_triggered();
    void on_actionFindNext_triggered();
    void on_actionOpen_triggered();
//    void on_actionHexView_trigged(bool checked);
//    void on_actionUDFView_triggered(bool checked);
//    void on_actionPDXPView_triggered(bool checked);
//    void on_actionFrameView_triggered(bool checked);
    void on_actionOptions_triggered();
	void on_actionAbout_triggered();
    void on_actionLineChart_triggered();
    void on_actionSplineChart_triggered();
    void on_actionBarChart_triggered();
    void saveAsTriggered(void);
    void undoTriggered(void);
    void redoTriggered(void);

private:
    Ui::MainWindow *ui;

    QComboBox* findBox;
    QRadioButton* findForward;
    QRadioButton* findBackward;
    QLabel* offsetLabel;
    QLabel* addressLabel;
    QTabWidget *tab;
    InsightView *insightView;
    QAction* contextAction;
    QActionGroup* viewGroup;
    QMap<QString, int> openFiles(void);


    QString m_sFile;
    ChartView*  m_pChartView;
    int m_nTab;

    int m_nView;

    void createActions(void);
    void createMenus(void);
    void createToolBar(void);
    void createStatusBar(void);
    void chartViewHide();
    void chartViewShow();
    void openFile(const QString& name);

public slots:
    void openTempFile(const QString& name);
    // QObject interface
public:
    bool eventFilter(QObject *object, QEvent *event);

    // QWidget interface
protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);
};

#endif // MAINWINDOW_H
